//getter 文件store的计算属性
export default{
    totalCount(state){

           // localStorage.setItem("defaultCartFoods",state.cartFoods)

        return  state.cartFoods.reduce((preCount,food)=>{
            return preCount+food.count
        },0)
    },

    totalPrice(state){
        return  state.cartFoods.reduce((prePrice,food)=>{
            return prePrice+food.count*food.price
        },0)
    },
    // positiveSize(state){
    //     return  state.ratings.reduce((preRating,rating)=>{
    //        return   (rating.rateType>0 ? 0 : 1) +preRating
    //     },0)
    // }


}
